/**
 * Created by Administrator on 2019/9/29.
 */
//i_bg bg_color
var $ = jQuery.noConflict();

$(function(){
    var pro;
    $.ajax({url:"/easybuy/home/floor",
        success:function(data){
            pro=JSON.parse(JSON.stringify(data))
        }
    });

    $.ajax({url:"/easybuy/home/menu",
        success:function(data){
            for(var i = 0;i<data.list1.length;i++){
                $div1=$("<div class='i_t mar_10' id='fa"+i+"'> " +
                   "<span class='floor_num'>"+(i+1)+"F</span> " +
                "<span class='fl'>"+data.list1[i].name+"</span> " +
                    "</div>");

                $div2=$("<div class=\"content\" id='content"+i+"'>\n" +
                    "    \t<div class=\"fresh_left\">\n" +
                    "        \t<div class=\"fre_ban\">\n" +
                    "            \t<div id=\"imgPlay1\">\n" +
                    "                    <ul class=\"imgs\" id=\"actor"+(i+1)+"\">\n" +
                    // "                        <li><a href=\"#\"><img src=\"images/fre_"+(i+1)+".jpg\" width=\"211\" height=\"286\" /></a></li>\n" +
                    // "                        <li><a href=\"#\"><img src=\"images/fre_"+(i+1)+".jpg\" width=\"211\" height=\"286\" /></a></li>\n" +
                    // "                        <li><a href=\"#\"><img src=\"images/fre_"+(i+1)+".jpg\" width=\"211\" height=\"286\" /></a></li>"+
                    "                    </ul>\n" +
                    "                    <div class=\"prevf\">上一张</div>\n" +
                    "                    <div class=\"nextf\">下一张</div> \n" +
                    "                </div>   \n" +
                    "            </div>\n" +
                    "            <div class=\"fresh_txt\">\n" +
                    "              <div class=\"fresh_txt_c\">\n" +

                    "               </div>"+
                    "            </div>\n" +
                    "        </div>\n" +
                    "        <div class=\"fresh_mid\">\n" +
                    "        \t<ul>\n" +


                    "            </ul>\n" +
                    "        </div>\n" +
                    "        <div class=\"fresh_right\">\n" +
                    "        \t<ul>\n" +
                    "            \t<li><a href=\"javascript:void(0)\"><img src=\"images/fre_b1.jpg\" width=\"260\" height=\"220\" /></a></li>\n" +
                    "                <li><a href=\"javascript:void(0)\"><img src=\"images/fre_b2.jpg\" width=\"260\" height=\"220\" /></a></li>\n" +
                    "            </ul>\n" +
                    "        </div>\n" +
                    "    </div>    ");

                $span1=$("<span class='i_mores fr'>" +
                    "</span>");


                for (var j = 0; j < data.list2.length; j++) {
                    if(data.list2[j].parentId==data.list1[i].id){
                       $span1.append("<a href=\"CategoryList.html?categoryLevel2Id="+data.list2[j].id+"&amp;name2="+data.list2[j].name+"\">"+data.list2[j].name+"</a>&nbsp; &nbsp; &nbsp;");
                    }
                }

                $div1.append($span1);
                $(".i_bg").append($div1);
                $(".i_bg").append($div2);

                for (var j = 0; j < pro.length; j++) {
                    if (pro[j].categoryLevel1Id==data.list1[i].id){
                        $("#content"+i+" .fresh_txt_c").append("<a href=\"Product.html?id="+pro[j].id+"\">"+pro[j].name+"</a>");
                        $("#content"+i+" .fresh_mid ul").append("<li>\n" +
                            "                \t<div class=\"name\"><a href=\"Product.html?id="+pro[j].id+"\">"+pro[j].name+"</a></div>\n" +
                            "                    <div class=\"price\">\n" +
                            "                    \t<font>￥<span>"+pro[j].price+"</span></font> &nbsp; 25R\n" +
                            "                    </div>\n" +
                            "                    <div class=\"img\"><a href=\"Product.html?id="+pro[j].id+"\"><img src=\"images/"+pro[j].fileName+"\" width=\"185\" height=\"155\" /></a></div>\n" +
                            "                </li>");
                        $("#actor"+(i+1)).append("<li><a href=\"Product.html?id="+pro[j].id+"\"><img src=\"images/"+pro[j].fileName+"\" width=\"211\" height=\"286\" /></a></li>");
                    }
                }
            }
        }
});

});

